<template>
  <main>
    <large-page v-if="nowPage == 'lar'" @changePage="changePage"/>
    <monitor-page v-else-if="nowPage == 'mon'" @changePage="changePage"/>
    <simulation-page v-else-if="nowPage == 'sim'" @changePage="changePage"/>
  </main>
</template>

<script setup>
import { ref } from 'vue'

import largePage from './views/large_page/large_page.vue'
import monitorPage from './views/monitor_page/moniter_page.vue'
import simulationPage from './views/simulation_page/simulation_page.vue'

var nowPage = ref('lar');

// 初始全局 sessionStorage 变量
if(window.sessionStorage.getItem('nowPage')) nowPage.value = window.sessionStorage.getItem('nowPage');

/**
 * 函数相关
 */
const changePage = (value) => { // eslint-disable-line no-unused-vars
  nowPage.value = value;
  window.sessionStorage.setItem('nowPage', value);

  // 同时，在进入 mon 页面时，重置全局变量 isTitle 的值
  if(value == 'mon') window.sessionStorage.setItem('isTitle', 'Show'); 
}
</script>

<style>
  @import "./assets/css/reset.css";

</style>
